shorthand->assign (shorthand, props, state, value);
}
-static GtkCssValue *
+static void
_gtk_css_shorthand_property_query (GtkStyleProperty *property,
+ GValue *value,
GtkStyleQueryFunc query_func,
gpointer query_data)
{
GtkCssShorthandProperty *shorthand = GTK_CSS_SHORTHAND_PROPERTY (property);
- return shorthand->query (shorthand, query_func, query_data);
+ return shorthand->query (shorthand, value, query_func, query_data);
}
static void
g_value_unset (&v);
}
-static GtkCssValue *
+static void
pack_border (GtkCssShorthandProperty *shorthand,
+ GValue *value,
GtkStyleQueryFunc query_func,
gpointer query_data)
{
if (v)
border.left = _gtk_css_value_get_int (v);
- return _gtk_css_value_new_from_border (&border);
+ g_value_init (value, GTK_TYPE_BORDER);
+ g_value_set_boxed (value, &border);
}
static void
g_value_unset (&v);
}
-static GtkCssValue *
+static void
pack_border_radius (GtkCssShorthandProperty *shorthand,
+ GValue *value,
GtkStyleQueryFunc query_func,
gpointer query_data)
{
const GtkCssBorderCornerRadius *top_left;
GtkCssStyleProperty *prop;
GtkCssValue *v;
- int value = 0;
+ int i = 0;
prop = GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("border-top-left-radius"));
v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
{
top_left = _gtk_css_value_get_border_corner_radius (v);
if (top_left)
- value = top_left->horizontal.value;
+ i = top_left->horizontal.value;
}
- return _gtk_css_value_new_from_int (value);
+ g_value_init (value, G_TYPE_INT);
+ g_value_set_int (value, i);
}
static void
}
}
-static GtkCssValue *
+static void
pack_font_description (GtkCssShorthandProperty *shorthand,
+ GValue *value,
GtkStyleQueryFunc query_func,
gpointer query_data)
{
if (v)
pango_font_description_set_weight (description, _gtk_css_value_get_pango_weight (v));
- return _gtk_css_value_new_take_font_description (description);
+ g_value_init (value, PANGO_TYPE_FONT_DESCRIPTION);
+ g_value_take_boxed (value, description);
}
static void
}
}
-static GtkCssValue *
+static void
pack_first_element (GtkCssShorthandProperty *shorthand,
+ GValue *value,
GtkStyleQueryFunc query_func,
gpointer query_data)
{
GtkCssStyleProperty *prop;
- GtkCssValue *v;
- guint i;
/* NB: This is a fallback for properties that originally were
* not used as shorthand. We just pick the first subproperty
* as a representative.
* Lesson learned: Don't query the shorthand, query the
* real properties instead. */
- for (i = 0; i < _gtk_css_shorthand_property_get_n_subproperties (shorthand); i++)
- {
- prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 0);
- v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
- if (v)
- {
- return _gtk_css_value_ref (v);
- }
- }
- return NULL;
+ prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 0);
+ _gtk_style_property_query (GTK_STYLE_PROPERTY (prop),
+ value,
+ query_func,
+ query_data);
}
static void
GtkStyleProperties *props,
GtkStateFlags state,
const GValue *value);
-typedef GtkCssValue * (* GtkCssShorthandPropertyQueryFunc) (GtkCssShorthandProperty *shorthand,
+typedef void (* GtkCssShorthandPropertyQueryFunc) (GtkCssShorthandProperty *shorthand,
+ GValue *value,
GtkStyleQueryFunc query_func,
gpointer query_data);
_gtk_css_value_unref (css_value);
}
-static GtkCssValue *
+static void
_gtk_css_style_property_query (GtkStyleProperty *property,
+ GValue *value,
GtkStyleQueryFunc query_func,
gpointer query_data)
{
cairo_surface_t *surface;
cairo_matrix_t matrix;
- if (image == NULL)
- return _gtk_css_value_new_from_pattern (NULL);
- else if (GTK_IS_CSS_IMAGE_GRADIENT (image))
- return _gtk_css_value_new_from_pattern (GTK_CSS_IMAGE_GRADIENT (image)->pattern);
- else
+ g_value_init (value, CAIRO_GOBJECT_TYPE_PATTERN);
+
+ if (GTK_IS_CSS_IMAGE_GRADIENT (image))
+ g_value_set_boxed (value, GTK_CSS_IMAGE_GRADIENT (image)->pattern);
+ else if (image != NULL)
{
double width, height;
cairo_matrix_init_scale (&matrix, width, height);
cairo_pattern_set_matrix (pattern, &matrix);
cairo_surface_destroy (surface);
- return _gtk_css_value_new_take_pattern (pattern);
+ g_value_take_boxed (value, pattern);
}
}
else if (_gtk_css_value_holds (css_value, GTK_TYPE_CSS_NUMBER))
{
- int v = round (_gtk_css_number_get (_gtk_css_value_get_number (css_value), 100));
- return _gtk_css_value_new_from_int (v);
+ g_value_init (value, G_TYPE_INT);
+ g_value_set_int (value, round (_gtk_css_number_get (_gtk_css_value_get_number (css_value), 100)));
}
else
- return _gtk_css_value_ref (css_value);
+ {
+ _gtk_css_value_init_gvalue (css_value, value);
+ }
}
else
- return _gtk_css_value_ref (_gtk_css_style_property_get_initial_value (GTK_CSS_STYLE_PROPERTY (property)));
+ {
+ _gtk_css_value_init_gvalue (_gtk_css_style_property_get_initial_value (GTK_CSS_STYLE_PROPERTY (property)),
+ value);
+ }
}
static gboolean
GtkStyleContextPrivate *priv;
GtkStyleProperty *prop;
StyleData *data;
- GtkCssValue *v;
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
g_return_if_fail (property != NULL);
}
data = style_data_lookup (context, state);
- v = _gtk_style_property_query (prop, gtk_style_context_query_func, data->store);
- _gtk_css_value_init_gvalue (v, value);
- _gtk_css_value_unref (v);
+ _gtk_style_property_query (prop, value, gtk_style_context_query_func, data->store);
}
/**
{
StyleQueryData query = { props, state };
GtkStyleProperty *node;
- GtkCssValue *v;
g_return_val_if_fail (GTK_IS_STYLE_PROPERTIES (props), FALSE);
g_return_val_if_fail (property != NULL, FALSE);
return FALSE;
}
- v = _gtk_style_property_query (node,
- style_query_func,
- &query);
- _gtk_css_value_init_gvalue (v, value);
- _gtk_css_value_unref (v);
+ _gtk_style_property_query (node,
+ value,
+ style_query_func,
+ &query);
return TRUE;
}
* turn gtk_style_context_get() and similar functions to get the
* value to return to code using old APIs.
**/
-GtkCssValue *
+void
_gtk_style_property_query (GtkStyleProperty *property,
+ GValue *value,
GtkStyleQueryFunc query_func,
gpointer query_data)
{
GtkStylePropertyClass *klass;
- g_return_val_if_fail (GTK_IS_STYLE_PROPERTY (property), NULL);
- g_return_val_if_fail (query_func != NULL, NULL);
+ g_return_if_fail (value != NULL);
+ g_return_if_fail (GTK_IS_STYLE_PROPERTY (property));
+ g_return_if_fail (query_func != NULL);
klass = GTK_STYLE_PROPERTY_GET_CLASS (property);
- return klass->query (property, query_func, query_data);
+ return klass->query (property, value, query_func, query_data);
}
void
GtkStyleProperties *props,
GtkStateFlags state,
const GValue *value);
- GtkCssValue * (* query) (GtkStyleProperty *property,
+ void (* query) (GtkStyleProperty *property,
+ GValue *value,
GtkStyleQueryFunc query_func,
gpointer query_data);
gboolean (* parse_value) (GtkStyleProperty * property,
GFile *base);
GType _gtk_style_property_get_value_type(GtkStyleProperty * property);
-GtkCssValue * _gtk_style_property_query (GtkStyleProperty * property,
+void _gtk_style_property_query (GtkStyleProperty * property,
+ GValue *value,
GtkStyleQueryFunc query_func,
gpointer query_data);
void _gtk_style_property_assign (GtkStyleProperty *property,